home *** CD-ROM | disk | FTP | other *** search
- using System;
- using System.Collections.Generic;
- using System.Text;
- using System.ComponentModel;
- using System.Windows.Media;
- using System.Windows.Ink;
-
- namespace UntitledProject1
- {
- /// <summary>
- /// INotifyPropertyChanged allows that properties of the Class InkPen
- /// participate as source in data bindings.
- /// </summary>
- public class InkPen : INotifyPropertyChanged
- {
- private Color penColor = Colors.Black;
- private SolidColorBrush myBrush = new SolidColorBrush(Colors.Black);
- private DrawingAttributes attributes = new DrawingAttributes();
-
- #region Public Attributes
-
- public DrawingAttributes Attributes
- {
- get
- {
- this.attributes.Color = this.penColor;
- return this.attributes;
- }
- }
-
- public Brush InkBrush
- {
- get
- {
- myBrush.Color = this.penColor;
- return myBrush;
- }
- }
-
- #endregion
-
- /// <summary>
- /// INotifyPropertyChanged requires a property called PropertyChanged.
- /// </summary>
- public event PropertyChangedEventHandler PropertyChanged;
-
- /// <summary>
- /// Fires the event for the property when it changes.
- /// </summary>
- private void OnPropertyChanged(string propertyName)
- {
- if (this.PropertyChanged != null)
- {
- // In order to INotifyPropertyChanged to work it is necessary
- // that the property fires the event whenever it changes.
- this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
- }
- }
-
- }
- }
-